package org.budo.filestore.tencent.cos;

import org.budo.filestore.impl.AbstractFileStore;

import com.qcloud.cos.COSClient;
import com.qcloud.cos.ClientConfig;
import com.qcloud.cos.auth.BasicSessionCredentials;
import com.qcloud.cos.auth.COSCredentials;
import com.qcloud.cos.region.Region;

import lombok.Getter;
import lombok.Setter;

/**
 * @author lmw
 */
@Getter
@Setter
public abstract class AbstractTencentCosFileStore extends AbstractFileStore {
    private String bucketName;

    protected COSClient getCosClient() {
        String appId = null;
        String accessKey = null;
        String secretKey = null;
        String sessionToken = null;
        COSCredentials cosCredentials = new BasicSessionCredentials(appId, accessKey, secretKey, sessionToken);
        ClientConfig clientConfig = new ClientConfig(new Region("cn-north"));
        COSClient cosClient = new COSClient(cosCredentials, clientConfig);
        return cosClient;
    }
}